$(document).ready(init);

/**
 * 初始化
 */
function init() {
	$('#search').click(doquery);
	
	query({});
}


function doquery() {
	var deptNo = $.trim($('#deptNo').val());
	var loginAccount = $.trim($('#loginAccount').val());
	
	var params = {
		'chargeLog.loginAccount' : loginAccount,
		'chargeLog.deptNo' : deptNo
	}
	
	query(params);
}

/**
 * 查询
 */
function query(params) {
	$('#chargeLog').datagrid({
	    title:'充值记录',
	    singleSelect:true,
	    url:'charge-log-admin!queryChargeLogs.action?' + params.bp,
	    queryParams :params,
	    rownumbers : true,
	    idField: 'id',
	    columns:[[
	        {field:'deptNo',title:'机构编号',width:fixWidth(0.12)},
	        {field:'deptName',title:'机构名称',width:fixWidth(0.18)},
	        {field:'loginAccount',title:'操作员',width:fixWidth(0.11)},
	        {field:'charger',title:'金额(元)',width:fixWidth(0.08)},
	        {field:'type',title:'充值类型',width:fixWidth(0.11),
	        		formatter : function(value, row, index) {
						if ('1' == value) {
							return '充值';
				 		} else {
							return '退款';
						}
					}
	        },
	        {field:'remark',title:'备注',width:fixWidth(0.2)},
	        {field:'createTime',title:'充值时间',width:fixWidth(0.12)}
	    ]],
	    pageList:[10, 20],
	    pagination:true,
	    fitColumns:true
	});
}